#include <bits/stdc++.h>
#define int long long
using namespace std;

class Matrix {
public:
    int n, m, a[105][105];
    Matrix(int N, int M)
    {
        n = N, m = M;
        memset(a, 0, sizeof(a));
    }
    Matrix(int N)
    {
        n = N, m = N;
        memset(a, 0, sizeof(a));
        for (int i = 1; i <= n; i++)
            a[i][i] = 1;
    }
    Matrix operator*(Matrix b)
    {
        Matrix c(n, b.m);
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= b.m; j++)
                for (int k = 1; k <= m; k++)
                    c.a[i][j] += a[i][k] * b.a[k][j], c.a[i][j] %= 30011;
        return c;
    }
    int* operator[](int x)
    {
        return a[x];
    }
};

Matrix quick_pow(Matrix a, int k)
{
    Matrix ans(a.n, a.n);
    for (int i = 1; i <= a.n; i++)
        ans.a[i][i] = 1;
    while (k) {
        if (k & 1)
            ans = ans * a;
        a = a * a;
        k >>= 1;
    }
    return ans;
}

void update(Matrix& a, int i, int j, bool p)
{
    if (j > a.n / 2 || j < 1)
        return;
    a[i][j + (p ? a.n / 2 : 0)]++;
}

signed main()
{
    int n, m;
    cin >> n >> m;
    Matrix A1(n * 2, n * 2), A2(n * 2, n * 2), B(n * 2, 1);
    B[1][1] = 1;
    for (int i = 1; i <= n * 2; i++)
        A1[i][i] = 1, A2[i][i] = 1;
    for (int i = 1; i <= n; i++) 
        update(A1, i, i, 1), update(A1, i, i + 1, 1), update(A1, i, i - 1, 1);
    for (int i = 1; i <= n; i++) 
        update(A2, i + n, i, 0), update(A2, i + n, i + 1, 0), update(A2, i + n, i - 1, 0);
    B = quick_pow(A2 * A1, (m - 1) / 2) * (m % 2 ? Matrix(n * 2) : A2) * B;
    if (m % 2)
        cout << (B[n + n][1] + B[n + n - 1][1] * (n != 1)) % 30011 << endl;
    else
        cout << (B[n][1] + B[n - 1][1] * (n != 1)) % 30011 << endl;
    return 0;
}
